package es.ats.codington.festival.junit.services;

import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import es.ats.codington.festival.daos.VisitorDAOImp;
import es.ats.codington.festival.domain.Event;
import es.ats.codington.festival.domain.Places;
import es.ats.codington.festival.domain.Visitor;
import es.ats.codington.festival.services.EventDAOService;
import es.ats.codington.festival.services.PlaceDAOService;
import es.ats.codington.festival.services.VisitorService;
import es.ats.codington.festival.utils.FERSDataConnection;

public class tVisitorService extends TestCase {

	Visitor visitor;
	VisitorService visitorService;

	
	
	@Before
	protected void setUp() throws Exception {
		super.setUp();
		visitor = new Visitor("Luis","Lopez","Burundanga","juan@hotmail.com","7574735-H","666555444","Calle Melancolia","****",false);
		visitorService = new VisitorService();
	}

	@After
	protected void tearDown() throws Exception {
		super.tearDown();
	}
	
	@Test
	public void testInsertVisitor(){
		int nRow = 0;
		nRow = visitorService.insertVisitorService(visitor);
		assertEquals(1,nRow);
	}
	@Test
	public void testUpdateVisitor(){
		int nRow = 0;
		visitor.setnPhone("666999666");
		nRow = visitorService.updateVisitorSevice(visitor, visitor.getUserName());
		assertEquals(1,nRow);
	}
	@Test
	public void testLogin(){
		int nRow = 0;
		nRow = visitorService.loginDAOService(visitor.getUserName(),visitor.getPassword());
		assertEquals(1,nRow);
	}
	@Test
	public void testDeleteVisitor(){
		int nRow = 0;
		nRow = visitorService.deleteVisitorService(visitor.getUserName());
		assertEquals(1,nRow);
	}
}
